﻿using IEntities;
using System;
using System.Collections.Generic;
using System.Linq.Expressions;
using System.Text;
using System.Threading.Tasks;

namespace IServices
{
    public interface IBaseService<TEntity> where TEntity : class, IEntity
    {
         object[] Test();
         int Count();
         int Count(Expression<Func<TEntity, bool>> whereExpression);
         Task<int> CountAsync();
         Task<int> CountAsync(Expression<Func<TEntity, bool>> whereExpression);
         bool Delete(TEntity entity);
         Task DeleteAsync(TEntity entity);
         bool DeleteByID(object id);
         Task DeleteByIDAsync(object id);
         bool Deletes(dynamic[] ids);
         Task DeletesAsync(dynamic[] ids);
         TEntity Find(Expression<Func<TEntity, bool>> whereExpression);
         Task<TEntity> FindAsync(Expression<Func<TEntity, bool>> whereExpression);
         TEntity FindByID(object id);
         Task<TEntity> FindByIDAsync(object id);
         TEntity FirstOrDefault(object id);
         TEntity FirstOrDefault(Expression<Func<TEntity, bool>> whereExpression);
         Task<TEntity> FirstOrDefaultAsync(object id);
         Task<TEntity> FirstOrDefaultAsync(Expression<Func<TEntity, bool>> whereExpression);
         TEntity Get(object id);
         TEntity Get(Expression<Func<TEntity, bool>> whereExpression);
         List<TEntity> GetAllList();
         List<TEntity> GetAllList(Expression<Func<TEntity, bool>> whereExpression);
         Task<List<TEntity>> GetAllListAsync();
         Task<List<TEntity>> GetAllListAsync(Expression<Func<TEntity, bool>> whereExpression);
         Task<TEntity> GetAsync(object id);
         Task<TEntity> GetAsync(Expression<Func<TEntity, bool>> whereExpression);
         TEntity Insert(TEntity entity);
         object InsertAndGetID(TEntity entity);
         Task<object> InsertAndGetIDAsync(TEntity entity);
         Task<TEntity> InsertAsync(TEntity entity);
         List<TEntity> Query(Expression<Func<TEntity, bool>> whereExpression);
         Task<List<TEntity>> QueryAsync(Expression<Func<TEntity, bool>> whereExpression);
         List<TEntity> QueryPage(Expression<Func<TEntity, bool>> whereExpression, int pageIndex = 1, int pageSize = 10, int pageCount = 10);
         Task<List<TEntity>> QueryPageAsync(Expression<Func<TEntity, bool>> whereExpression, int pageIndex = 1, int pageSize = 10, int pageCount = 10);
         TEntity Update(TEntity entity);
         object UpdateAndGetID(TEntity entity);
         Task<object> UpdateAndGetIDAsync(TEntity entity);
         Task<TEntity> UpdateAsync(TEntity entity);
         List<TEntity> Updates(List<TEntity> entities);
         Task<List<TEntity>> UpdatesAsync(List<TEntity> entities);
    }
}
